<?php

/**
 * @category   Ahs
 * @package    Ahs_Auth
 * @subpackage Adapter
 * @author     Thibaut Cromphaut, Gaïtano Boeraeve, Matthias Mercy
 * @copyright  Copyright (c) 2011 memorygame
 */
class Ahs_Auth_Adapter_DbTable extends Zend_Auth_Adapter_DbTable
{

    public function __construct()
    {
        $dbAdapter = Zend_Db_Table::getDefaultAdapter();
        parent::__construct($dbAdapter);
        $this->setTableName('users')
             ->setIdentityColumn('user_email')
             ->setCredentialColumn('user_password')
        ;
    }

    /**
     * setCredential()
     * 
     * @param string $credential
     * @return Ahs_Auth_Adapter_DbTable
     */
    public function setCredential($credential)
    {
        return parent::setCredential( Ahs_Utility::hash($credential) );
    }
    
    /**
     * setIdentity()
     * 
     * @param string $value
     * @return Ahs_Auth_Adapter_DbTable
     */
    public function setIdentity($value)
    {
        return parent::setIdentity($value);
    }
    
}
